<?php

	// +----------------------------------------------------------------------
	// | 权限分组模型
	// +----------------------------------------------------------------------
	// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
	// +----------------------------------------------------------------------
	// | Author: 微尘 <yicmf@qq.com>
	// +----------------------------------------------------------------------

	namespace app\model\ucenter;

	class UserGrade extends Common
	{
		// 获取所有权限组
		public static function getAll()
		{
			return self::where('status', 1)->where('id', '>', 1)->column('title', 'id');
		}

		public function users()
		{
			return $this->hasMany(User::class);
		}
		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onBeforeInsert($data)
		{
			$data['status'] = 1;
		}

		// 类型转换
		protected $type = [
			'rules' => 'array'
		];
	}
